<script setup>
import { ref } from 'vue'
import { userUpdatePasswordService  } from '@/api/user.js'
import { ElMessage } from 'element-plus'

const dataModel= ref({
    oldPassword: '',
    newPassword: '',
    confirmPassword: ''
})
//提交修改密码的请求
const updataUserPwd = async() => {
  let result= await userUpdatePasswordService(dataModel.value)
  ElMessage.success(result.message ? result.message : "修改成功");
}

</script>
<template>
    <el-card class="page-container transparent-card">
        <template #header>
            <div class="header">
                <span>修改密码</span>
            </div>
        </template>
        <el-row>
            <el-col :span="12">
                <el-form :model="dataModel"  label-width="100px" size="large">
                    <el-form-item label="旧密码">
                        <el-input v-model="dataModel.oldPassword"></el-input>
                    </el-form-item>
                    <el-form-item label="新密码" >
                        <el-input v-model="dataModel.newPassword"></el-input>
                    </el-form-item>
                    <el-form-item label="重新输入" >
                        <el-input v-model="dataModel.confirmPassword"></el-input>
                    </el-form-item>
                    <el-form-item>
                        <el-button type="primary" @click="updataUserPwd">修改密码</el-button>
                    </el-form-item>
                </el-form>
            </el-col>
        </el-row>
    </el-card>
</template>
<style lang="scss" scoped>
.transparent-card {
  background-color: rgba(255, 255, 255, 0.8); /* 半透明背景 */
  backdrop-filter: blur(10px); /* 模糊效果 */
  border-radius: 8px; /* 圆角 */
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); /* 可选：轻微阴影效果 */
}
</style>